package zhu.areas.team.dao;

import java.sql.SQLException;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;

import zhu.areas.team.data.Team;
import zhu.common.dao.BaseDAOImpl;



public class TeamXieDAOImpl extends BaseDAOImpl implements ITeamXieDAO {
	
	public void save(Object object) {
		getHibernateTemplate().save(object);
	}

	
	
	public List<Team> findByTeamAustate(final Object object){
		
		return (List<Team>)getHibernateTemplate().execute(
				new HibernateCallback() {
					public Object doInHibernate(Session session)
							throws HibernateException, SQLException {
						String hql = "from "+"Team"+"  where  " + "TeamAuState" + " = '"
								+ object + "'";
						Query query = session.createQuery(hql);
						
						return query.list();
					}
				});
	}
  
	public void delete(Team team){
		try {
			super.delete(team);
			
		} catch (RuntimeException e) {
			e.printStackTrace();
			throw e;
		}
	}
}
